<?php
/**
 * @package SQL
 * @subpackage Query
 *
 */
abstract class Lead_Sql_Query_Join
{
	private $_table;
	private $_joinClause;
	
	private $_alias;
	
	public function __construct($table, $joinClause, $alias = false)
	{
		$this->_table = $table;
		$this->_joinClause = $joinClause;
		$this->_alias = $alias;
	}
	
	public function getSQL()
	{
		$phrase = " JOIN {$this->getTable()} ";
		if($this->_alias)
			$phrase .= " AS {$this->_alias} ";
		
		$phrase .= " ON ({$this->getJoinClause()}) ";
		
		return $phrase;
	}
	
	
	public function getJoinClause()
	{
	    return $this->_joinClause;
	}
	
	
	public function getTable()
	{
	    return $this->_table;
	}
}